package com.zking.repository;

import com.zking.entity.Customent;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.data.repository.reactive.ReactiveCrudRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;

@Repository
public interface CustomentRepsitory extends ReactiveCrudRepository<Customent,Integer> {

    /**
     * 更具年龄查找
     * @param start
     * @param end
     * @return
     */
 Flux<Customent> findByAgeBetween(int start,int end);

    /**
     * 另外一种
     * @param start
     * @param end
     * @return
     */
 @Query("select c from customent where age BETWEEN #{start} and #{end}")
 Flux<Customent>oldCustoment(@Param("start") int start ,@Param("end") int end);
}
